// ToolFrame.h
// 2008/12/18

#pragma once

/* */

const UINT WM_USERAP_CALLSYNC = WM_APP + 1000;

/* */

// ToolFrame
class ToolFrame :
	public WTL::CFrameWindowImpl<ToolFrame> {

	typedef WTL::CFrameWindowImpl<ToolFrame> TBase;

public:

	DECLARE_FRAME_WND_CLASS(_T("iASnapShotToolFrameWndClass"), 0)

	BEGIN_MSG_MAP_EX(ToolFrame)
		MSG_WM_CREATE (OnCreate )
		MSG_WM_DESTROY(OnDestroy)

//		MESSAGE_HANDLER(WM_USERAP_CALLSYNC, OnCallSync)

		CHAIN_MSG_MAP(TBase)
	END_MSG_MAP()

public:

	/* */

	static HWND CreateFrame()
	{
		ToolFrame* frame = new ToolFrame();

		WTL::CRect rect(0, 0, 0, 0);
		HWND hwnd = frame->Create(
			HWND_MESSAGE,
			rect,
			L"iASnapShotTool",
			WS_POPUPWINDOW,
			WS_EX_TOOLWINDOW);
		if (hwnd == 0) {
			delete frame;
			return 0;
		}

		return hwnd;
	}

	/* */

	ToolFrame()
	{
	}

	~ToolFrame()
	{
	}

	/* */

	virtual void OnFinalMessage(
		HWND /*hWnd*/)
	{
		delete this;
	}

	/* */

	LRESULT OnCreate(
		LPCREATESTRUCT /*pCreateStruct*/)
	{
		return 0;
	}

	void OnDestroy()
	{
	}

	/* */

#if 0
	LRESULT OnCallSync(
		UINT   uMsg,
		WPARAM wParam,
		LPARAM lParam,
		BOOL&  bHandled)
	{
		LuoSnapShot::CallParam* param = (LuoSnapShot::CallParam*)lParam;
		if (param == 0) {
			return 0;
		}

		if (param->Callback != 0) {
			INT_PTR result = (param->Callback)(
				param->Context);
			param->Result = result;
		}

		return 0;
	}
#endif

	/* */

}; // ToolFrame

/* */

